<?php   
    session_start();
    
    if(!isset($_SESSION["username"]))
    {
        
        
        header('HTTP/1.0 403 Forbidden');
        die('You are not allowed to access this site.');   
    }
    
    $serviceDir = '.' . DIRECTORY_SEPARATOR .'Services' .DIRECTORY_SEPARATOR;
    $slimDir = '.' . DIRECTORY_SEPARATOR .'Slim' .DIRECTORY_SEPARATOR;
    $classDir = '.' . DIRECTORY_SEPARATOR .'classes' .DIRECTORY_SEPARATOR;
    
    require_once $slimDir . "Middleware.php";
    require_once $slimDir . "Slim.php";
    require_once $classDir . "JsonMiddleware.php";
    require_once $classDir . 'Config.php';
    require_once $classDir . 'DB_UTIL.php';
    require_once $classDir . 'Security.php';
    require_once $classDir . 'LeoDatabaseHelper.php';
    require_once $classDir . "LEO.php";
    
    Config::ReadFile('.' . DIRECTORY_SEPARATOR . 'classes' .DIRECTORY_SEPARATOR . 'Config.txt');
    
    $dbUtil = new DB_UTIL();
    
    \Slim\Slim::registerAutoloader();

    $app = new \Slim\Slim();
    $app->contentType('text/html; charset=utf-8');

    $app->add(new JsonMiddleware());
    
    require_once $serviceDir . "LeoService.php";
    
    $app->run();
		
?>
